﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Web.Services;
using Newtonsoft.Json;

namespace PropertyAppraisal.SystemManage
{
    public partial class XiTongUser : System.Web.UI.Page
    {
        private static BLL.UsersBll userbll = new BLL.UsersBll();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        private static string Serialize(dynamic list)
        {
            return JsonConvert.SerializeObject(list);
        }
        /// <summary>
        /// 显示员工列表
        /// </summary>
        /// <returns></returns>
        [WebMethod]
        public static string showUsers(string name)
        {
            var result = userbll.Show();
            if (string.IsNullOrWhiteSpace(name))
            {
                return Serialize(result);
            }
            else
            {
                return Serialize(result.Where(n => n.users_Name.Contains(name)));
            }
        }
        /// <summary>
        /// 修改用户状态
        /// </summary>
        /// <param name="Users_Name">用户名称</param>
        /// <param name="Users_IsState">用户状态</param>
        /// <returns></returns>
        [WebMethod]
        public static bool updateState(string Users_Name, int Users_IsState)
        {
            return new BLL.UsersBll().updateState(Users_Name, Users_IsState);
        }

    }
}